# Copyright 2010 Google Inc. All Rights Reserved
# Makefile for TXM /src directory
# Erlang is not in 3rd party, the blaze BUILD will have to wait.
# Author jacoby@google.com (Jacoby Thwaites)

INCLUDE := ../include
EBIN 	:= ../ebin
PRIV	:= ../priv
BEAM	:= .beam
NAME	:= dev
COOKIE	:= txm
APP	:= txm

.SUFFIXES: .erl .beam

.erl.beam:
	erlc +debug_info +export_all -I $(INCLUDE) -o $(EBIN) $<

ERL := erl
ERLFLAGS := -name $(NAME) -setcookie $(COOKIE) -boot start_clean
ERLTRACE := -name trace -setcookie $(COOKIE) -boot start_clean

MODS :=	backup \
	cache_srv \
	fieldset_srv \
	graph \
	node_srv \
	nr_set nr_set_dict \
	process_cache \
	prog_srv prog \
	search \
	struct \
	trace \
	txm txm_log	txm_util\
	view_db view_fsm view_sup \
	web_srv web_util web_view\
	xj

all: compile

$(EBIN):
	-mkdir $(EBIN)

compile: $(EBIN) $(MODS:%=%.beam)

run:
	-cp $(PRIV)/$(APP).app $(EBIN)
	cd $(EBIN) && $(ERL) $(ERLFLAGS)

trace:
	cd $(EBIN) && $(ERL) $(ERLTRACE)

clean:
	-rm $(addprefix $(EBIN)/, $(addsuffix $(BEAM), $(MODS)))
